from tensorflow.keras import *
from tensorflow.keras.layers import *


def lstm(max_features):
    inputs = Input(shape=(None,), dtype="int32")
    x = Embedding(max_features, 128)(inputs)
    x = Bidirectional(LSTM(64, return_sequences=True))(x)
    x = Bidirectional(LSTM(64))(x)
    outputs = Dense(1, activation="sigmoid")(x)
    model = Model(inputs, outputs)
    model.summary()
    return model

model = lstm(20000)